package com.hmsproject.db;

import com.hmsproject.db.derbydb.HMSDerbyDBConnection;
import com.hmsproject.db.expediadb.HMSExepdiaDBConnection;
import com.hmsproject.db.inmemorydb.HMSInMemoryDBConnection;
import com.hmsproject.db.mongodb.HMSMongoDBConnection;

public class HMSDBConnectionFactory {
	
	private static HMSDBConnectionFactory hmsDBConnectionFactory = new HMSDBConnectionFactory();

	private HMSDBConnectionFactory(){}
	
	public static HMSDBConnectionFactory getInstance(){
		return hmsDBConnectionFactory;
	}
	
	public HMSDBConnection getDBConnection(){
		return getDBConnection(HMSDBType.INMEMORYDB);
	}
	
	public HMSDBConnection getDBConnection(HMSDBType hmsDBType){
		
		switch (hmsDBType)
		{
			case MONGODB:
				return HMSMongoDBConnection.getInstance();
			case EXPEDIADB:
				return HMSExepdiaDBConnection.getInstance();
			case INMEMORYDB:
				return HMSInMemoryDBConnection.getInstance();				
			case DERBYDB:
				return HMSDerbyDBConnection.getInstance();
			default:
				return HMSMongoDBConnection.getInstance();
		}
	}
}
